<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        .stage {
            width: 864px;
        }
        .box {
            position: relative;
            width: 864px;
            height: 540px;
        }
        .box ul li {
            position: absolute;
            height: 540px;
            list-style: none;
            transform-style: preserve-3d;
            transition: all 1s ease 0s;
        }
        .box ul li div {
            position: absolute;
            width: 100%;
            height: 100%;
            background-size: 864px 540px;
        }
        .box ul li div:nth-child(1) {
            background-image: url(./img/1.jpeg);
            transform: translateZ(270px);
        }
        .box ul li div:nth-child(2) {
            transform: rotateX(90deg) translateZ(270px);
            background-image: url(./img/2.jpeg);
        }
        .box ul li div:nth-child(3) {
            transform: rotateX(180deg) translateZ(270px);
            background-image: url(./img/3.jpeg);
        }
        .box ul li div:nth-child(4) {
            transform: rotateX(270deg) translateZ(270px);
            background-image: url(./img/4.jpeg);
        }
        .btn {
            display: block;
            width: 100px;
            height: 50px;
            margin: 0px auto;
            margin-top: 20px;
        }
    </style>
</head>
<body>
    <div class="stage">
        <div class="box">
            <ul></ul>
        </div>
        <input type="button" class="btn" value="下一张">
    </div>
    
    <script src="./jquery-1.12.4.min.js"></script>
    <script>
        var $ul = $('.box ul')
        var $btn = $('input:button')
        var num = 100;
        var sum = 0;
        var delay = 0.01,ewid = $('.box').width()/num;
        // console.log(ewid)
        // console.log($('.box').width())
        for(i = 0;i<num;i++) {
            var $li = $('<li><div></div><div></div><div></div><div></div></li>')
            $li.css({
                'left': i * ewid + "px",
                'width': ewid+'px',
                'transition-delay': i*delay+'s'
            }).children().css({
                'background-position': -i*ewid+"px 0",
            })
            $ul.append($li)
        }
        var $lis = $('.box ul li')
        // console.log($lis)
        var lock = false;
        var time = (1+ 0.1*($lis.length-1))
        $btn.click(function(){
            if (lock) return
            lock = true;
            sum -=90;
            $lis.css({
                'transform':'rotateX('+ sum +'deg)'
            })
            // 延时器
            // console.log(time)
            setTimeout(function(){
                lock = false
            },time)
        })
    </script>
</body>
</html>